import { htmlToDocx, docxToBuffer } from '../src';

describe('用户颜色继承测试', () => {
  test('验证文字能正确继承style标签中的color: red样式', async () => {
    const html = `<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <style type="text/css">
        body {
            color: red;
            font-size: 16px;
            font-family: "微软雅黑";
            margin: 0;
            max-width: 21cm;
            padding: 2.54cm;
        }
        
        p {
            margin: 0;
        }
    </style>
</head>
<body>
    <div>
        打火机手动滑稽阿萨德黄金卡
    </div>
</body>
</html>`;

    const result = await htmlToDocx(html);
    expect(result.document).toBeDefined();
    expect(result.warnings).toEqual([]);
    
    // 验证转换不会抛出错误
    const buffer = await docxToBuffer(result.document);
    expect(buffer).toBeDefined();
    expect(buffer instanceof Buffer || buffer instanceof Uint8Array).toBe(true);
    expect(buffer.length).toBeGreaterThan(0);
  });
});